package com.ruoyi.dgw.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dgw.mapper.VaccineMapper;
import com.ruoyi.dgw.domain.Vaccine;
import com.ruoyi.dgw.service.IVaccineService;

import javax.annotation.Resource;

/**
 * 疫苗Service业务层处理
 * 
 * @author lw
 * @date 2021-11-16
 */
@Service
public class VaccineServiceImpl implements IVaccineService 
{
    @Resource
    private VaccineMapper vaccineMapper;

    /**
     * 查询疫苗
     * 
     * @param id 疫苗主键
     * @return 疫苗
     */
    @Override
    public Vaccine selectVaccineById(Long id)
    {
        return vaccineMapper.selectVaccineById(id);
    }

    /**
     * 查询疫苗列表
     * 
     * @param vaccine 疫苗
     * @return 疫苗
     */
    @Override
    public List<Vaccine> selectVaccineList(Vaccine vaccine)
    {
        return vaccineMapper.selectVaccineList(vaccine);
    }

    /**
     * 新增疫苗
     * 
     * @param vaccine 疫苗
     * @return 结果
     */
    @Override
    public int insertVaccine(Vaccine vaccine)
    {
        vaccine.setCreateTime(DateUtils.getNowDate());
        return vaccineMapper.insertVaccine(vaccine);
    }

    /**
     * 修改疫苗
     * 
     * @param vaccine 疫苗
     * @return 结果
     */
    @Override
    public int updateVaccine(Vaccine vaccine)
    {
        vaccine.setUpdateTime(DateUtils.getNowDate());
        return vaccineMapper.updateVaccine(vaccine);
    }

    /**
     * 批量删除疫苗
     * 
     * @param ids 需要删除的疫苗主键
     * @return 结果
     */
    @Override
    public int deleteVaccineByIds(Long[] ids)
    {
        return vaccineMapper.deleteVaccineByIds(ids);
    }

    /**
     * 删除疫苗信息
     * 
     * @param id 疫苗主键
     * @return 结果
     */
    @Override
    public int deleteVaccineById(Long id)
    {
        return vaccineMapper.deleteVaccineById(id);
    }

    @Override
    public List<Map<String,String>> querySum(String nickName) {
        return vaccineMapper.querySum(nickName);
    }
}
